home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-10-11 | 5.1 KB | 235 lines | [TEXT/CWIE] |
- // CRadios.cp -- window methods
-
- #include "CRadios.h"
-
- #include <UEnvironment.h>
- #include <UReanimator.h>
- #include <URegistrar.h>
- #include <LStream.h>
- #include <LTabGroup.h>
- #include <LRadioGroupView.h>
- #include <LRadioButton.h>
- #include <LAMControlImp.h>
- #include <LGARadioButtonImp.h>
- #include <LTextGroupBox.h>
- #include <LAMControlViewImp.h>
- #include <LGATextGroupBoxImp.h>
- #include <CustomControls.h>
- #include <LBevelButton.h>
- #include <LAMBevelButtonImp.h>
- #include <LGABevelButtonImp.h>
- #include <LTextButton.h>
- #include <CTextUtils.h>
-
- #include "DDocData.h"
- #include "DModalCheckboxesData.h"
- #include "DModalRadiosData.h"
- #include "DModalTextData.h"
- #include "DModalStuffData.h"
- #include "DModalBarsData.h"
- #include "DModelessCheckboxesData.h"
- #include "DModelessRadiosData.h"
- #include "DModelessTextData.h"
- #include "DModelessStuffData.h"
- #include "DModelessBarsData.h"
- #include "EverythingCmds.h"
-
-
- #define PPob_RadiosID 203
- #define RidL_RadiosID 203
-
- Boolean CRadios::sIsRegistered = false;
-
- //----------
- CRadios* CRadios::CreateRadios (
- LCommander* inSuperCommander,
- DDocData* inData)
- {
- if (!sIsRegistered) {
- RegisterClass ();
- }
-
- CRadios* window;
- window = (CRadios *)LWindow::CreateWindow(PPob_RadiosID, inSuperCommander);
- window->ConnectToData (inData);
- return window;
- }
-
- //----------
- #define RegisterClasses(AbstractClass,AMImpClass,GAImpClass) \
- RegisterClass_(AbstractClass); \
- if (useAppearance) { \
- RegisterClassID_(AMImpClass, AbstractClass::imp_class_ID); \
- } else { \
- RegisterClassID_(GAImpClass, AbstractClass::imp_class_ID); \
- }
-
- //----------
- void CRadios::RegisterClass ()
- {
- Boolean useAppearance = UEnvironment::HasFeature (env_HasAppearance);
-
- RegisterClass_(CRadios);
-
- // register the pane classes we use
- RegisterClass_(LRadioGroupView);
- RegisterClasses (LRadioButton, LAMControlImp, LGARadioButtonImp);
- RegisterClasses (LTextGroupBox, LAMControlViewImp, LGATextGroupBoxImp);
- RegisterClasses (CRadioButton, CustomControlImp, CustomControlImp);
- RegisterClasses (LBevelButton, LAMBevelButtonImp, LGABevelButtonImp);
- RegisterClass_(LTextButton);
-
- sIsRegistered = true;
- }
-
- //----------
- CRadios::CRadios (
- LStream* inStream)
- : LWindow (inStream)
- {
- }
-
- //----------
- CRadios::~CRadios ()
- {
- }
-
- //----------
- // This member function gets called once the containment hierarchy that contains
- // this pane has been built. It gives us a chance to get data members for
- // interesting subviews, and to do other operations now that our subviews exist.
- void CRadios::FinishCreateSelf ()
- {
- mRadioGroupGroup = (LRadioGroupView*) FindPaneByID ('Radp');
-
- mStandardRadio = (LRadioButton*) FindPaneByID ('Stad');
-
- mGroupGroup = (LRadioGroupView*) FindPaneByID ('Grop');
-
- mGraphicGroup = (LRadioGroupView*) FindPaneByID ('Grac');
-
- mStopRadio = (CRadioButton*) FindPaneByID ('Stop');
-
- mGoRadio = (CRadioButton*) FindPaneByID ('Go ');
-
- mBevelGroup = (LRadioGroupView*) FindPaneByID ('Bevl');
-
- mRadioButtonRadio = (LBevelButton*) FindPaneByID ('Radn');
-
- mRadioButton2Radio = (LBevelButton*) FindPaneByID ('Rad2');
-
- mTextGroup = (LRadioGroupView*) FindPaneByID ('Text');
-
- mNameRadio = (LTextButton*) FindPaneByID ('Name');
-
- mKindRadio = (LTextButton*) FindPaneByID ('Kind');
-
- mSizeRadio = (LTextButton*) FindPaneByID ('Size');
-
-
- UReanimator::LinkListenerToControls(this, this, RidL_RadiosID);
- // "connect" self to our controls that we want to "listen" to
-
- // any additional initialization for your window:
- }
-
- //----------
- void CRadios::ConnectToData (
- DDocData* inData)
- {
- mData = inData;
- mData->AddListener (this);
-
- mRadioGroupGroup->SetValue (mData->GetRadioGroup ());
- mGroupGroup->SetValue (mData->GetGroup ());
- mGraphicGroup->SetValue (mData->GetGraphic ());
- mBevelGroup->SetValue (mData->GetBevel ());
- mTextGroup->SetValue (mData->GetText ());
- }
-
- //----------
- void CRadios::DataChanged (
- long inDataID)
- {
- StopListening ();
-
- if (inDataID == idRadioGroup) {
- mRadioGroupGroup->SetValue (mData->GetRadioGroup ());
- }
- if (inDataID == idGroup) {
- mGroupGroup->SetValue (mData->GetGroup ());
- }
- if (inDataID == idGraphic) {
- mGraphicGroup->SetValue (mData->GetGraphic ());
- }
- if (inDataID == idBevel) {
- mBevelGroup->SetValue (mData->GetBevel ());
- }
- if (inDataID == idText) {
- mTextGroup->SetValue (mData->GetText ());
- }
-
- StartListening ();
- }
-
- //----------
- void CRadios::ListenToMessage (
- MessageT inMessage,
- void* ioParam)
- {
- switch (inMessage) {
- case msgDataChanged:
- DataChanged ((long)ioParam);
- break;
-
- default:
- ; // do something
- break;
- }
- }
-
- //----------
- Boolean CRadios::ObeyCommand (
- CommandT inCommand,
- void* ioParam)
- {
- Boolean cmdHandled = true;
-
- if (inCommand < 0) {
- // modal dialog has finished
-
- switch (-inCommand) {
- }
-
- } else {
- switch (inCommand) {
-
- default:
- cmdHandled = LWindow::ObeyCommand(inCommand, ioParam);
- break;
- }
- }
-
- return cmdHandled;
- }
-
- //----------
- void CRadios::FindCommandStatus (
- CommandT inCommand,
- Boolean &outEnabled,
- Boolean &outUsesMark,
- Char16 &outMark,
- Str255 outName)
- {
- outUsesMark = false;
-
- switch (inCommand) {
-
-
- default:
- LWindow::FindCommandStatus(inCommand, outEnabled,
- outUsesMark, outMark, outName);
- break;
- }
- }
-